<template>
    <div class="qrcode">
      <van-nav-bar title="扫码进入小程序" class="navBar" left-arrow @click-left="back()"></van-nav-bar>
      <div class="box">
        <div class="content">
          <van-image v-show="route.params.result=='success'" width="100" height="100" fit="fill" src="/img/cg.png" class="tipImg"/>
          <van-image v-show="route.params.result!='success'" width="100" height="100" fit="fill" src="/img/yyhy.png" class="tipImg"/>
          <h4 :class="route.params.result=='success'?'successTip':'tip'">{{title[0]}}</h4>
          <h5 class="enter">{{title[1]}}</h5>
          <div class="line"></div>
          <van-image
              width="250"
              height="200"
              fit="fill"
              src="/img/qrcode.png"
          />
        </div>
      </div>
      <div class="bar"></div>
    </div>
</template>
<script setup>
const msg = {
  success:['已成功注册会员','请让顾客用微信扫码进入小程序，并登录进行关联'],
  exists:["该用户已注册","请直接扫码进入小程序"]
}
import { ref } from "@vue/reactivity"
import { onMounted } from "@vue/runtime-core"
import { useRouter,useRoute } from "vue-router"
import img from 'assets/qrcode.png'
import yyhy from 'assets/yyhy.png'
import cg from 'assets/cg.png'

const router = useRouter()
const route = useRoute()

const title = ref('')

onMounted(()=>{
  console.log(route.params.result,9999)
  title.value=msg[route.params.result]
})

const getSrc = (name) => {
  const path = `/assets/${name}.png`;
  const modules = import.meta.globEager("/assets/*.png");
  return modules[path].default;
}

const back = () => {
    router.replace('/home')
}
</script>
<style lang="scss" scoped>
.qrcode{
  background: #F1F5F8;
  height: 100vh;
  .navBar{
    background: #fff;
  }
  .box{
    background: #F1F5F8;
    padding:.9375rem /* 15/16 */;
    .content{
      background: #FFFFFF;
      border-radius: .625rem /* 10/16 */;
      .tipImg{
        margin-top:.625rem /* 10/16 */;
      }
      .tip{
        margin:0;
        font-size: 1.0625rem /* 17/16 */;
        font-family: PingFang SC;
        font-weight: 500;
        color: #FBB01F;
        line-height: 1.5625rem /* 25/16 */;
      }
      .successTip{
        margin:0;
        font-size: 1.0625rem /* 17/16 */;
        font-family: PingFang SC;
        font-weight: 500;
        color: #20B3A1;
        line-height: 1.5625rem /* 25/16 */;
      }
      .line{
        width: 95%;
        height: 1px;
        margin: 1.5625rem /* 25/16 */ auto;
        background: #E5EBEF;
      }
      .enter{
        font-size: .875rem /* 14/16 */;
        font-family: PingFang SC;
        font-weight: 500;
        color: #666666;
        line-height: 1.5625rem /* 25/16 */;
      }
    }
  }
  .bar{
      width: 8.375rem /* 134/16 */;
      height: .3125rem /* 5/16 */;
      background: #101D34;
      border-radius: .15625rem /* 2.5/16 */;
      position: fixed;
      bottom:.3125rem /* 5/16 */;
      left:30%;
  }
}
</style>